package com.ruoyi.fly.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.fly.domain.ServerOrder;
import com.ruoyi.fly.domain.vo.DeleteVo;
import com.ruoyi.fly.domain.vo.ServerOrderSearchVo;
import com.ruoyi.fly.domain.vo.ServerOrderVo;
import com.ruoyi.fly.service.ServerOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/serverOrder")
@Api(tags = "用户理疗记录管理")
public class ServerOrderController extends BaseController {

    @Autowired
    private ServerOrderService serverOrderService;


    /**
     * 查询用户理疗列表
     * @param serverOrderSearchVo
     * @return
     */
    @PostMapping("/list")
    @ApiOperation(value = "查询用户理疗列表")
    public TableDataInfo list(@RequestBody ServerOrderSearchVo serverOrderSearchVo) {
        PageDomain pageDomain = new PageDomain();
        BeanUtils.copyProperties(serverOrderSearchVo,pageDomain);
        startPage(pageDomain);
        List<ServerOrderVo> list = serverOrderService.selectAppletServerOrderList(serverOrderSearchVo);
        return getDataTable(list);
    }

    /**
     * 根据id查询用户理疗详情
     * @param id
     * @return
     */
    @GetMapping(value = "/selete/{id}")
    @ApiOperation(value = "根据id查询用户理疗详情")
    public R getInfo(@PathVariable("id") String id) {
        return R.ok(serverOrderService.selectAppletServerOrderById(id));
    }

//    /**
//     * 新增用户理疗
//     * @param serverOrder
//     * @return
//     */
//    @PostMapping("/add")
//    public R add(@RequestBody ServerOrder serverOrder) {
//        return serverOrderService.insertAppletServerOrder(serverOrder);
//    }
//
//    /**
//     * 修改用户理疗
//     * @param serverOrder
//     * @return
//     */
//    @PostMapping("/edit")
//    @ApiOperation(value = "修改用户理疗")
//    public R edit(@RequestBody ServerOrder serverOrder) {
//        return serverOrderService.updateAppletServerOrder(serverOrder);
//    }

//    /**
//     * 删除用户理疗
//     * @param deleteVo
//     * @return
//     */
//    @PostMapping("/delete")
//    @ApiOperation(value = "删除用户理疗")
//    public R remove(@RequestBody DeleteVo deleteVo) {
//        return serverOrderService.deleteAppletServerOrderByIds(deleteVo.getIds());
//    }
}
